package com.redxiii.spike.pmi.command;

import com.redxiii.spike.api.command.CommandFactory;
import com.redxiii.spike.api.command.InitializationRequired;
import com.redxiii.spike.api.message.ImMessage;
import com.redxiii.spike.pmi.HandlerSession;
import com.redxiii.spike.pmi.commons.UserSettings;
import com.redxiii.spike.util.command.InternetCommand;
import com.redxiii.spike.util.message.BasicMsgInterpreter;

/**
 * @author Daniel Filgueiras
 * @since 19/06/2011
 */
@CommandFactory(BasicMsgInterpreter.class)
@InitializationRequired
public class PauseWork extends InternetCommand {

	@Override
	public boolean proccess(ImMessage message) {
		
		UserSettings settings = HandlerSession.getUserSettings(remoteId);
		
		if (settings.getWorkingIssue() == 0) {
			service.reply(message, "You are not working on any issue");
		} else {
			settings.pauseWork();
		}
		
		return true;
	}

}
